package kuzmenkov.applet;

import java.awt.Color;

/**
 * The class represents a node 'field' in a XML screen file
 * @author Michael Kuzmenkov
 *
 */
public class Field {
	private Color color;
	private int column;
	//private int length;
	//private String name;
	private int row;
	private String content;
	
	public static final Color DEFAULT_COLOR = Color.WHITE;
	
	public Field (Color color, int column, int row, String content) {
		setColor(color);
		setColumn(column);
		setRow(row);
		setContent(content);
	}
	
	public Color getColor() {
		return color;
	}
	
	
	public void setColor(Color color) {
		if (color == null)
			color = DEFAULT_COLOR;
		this.color = color;
	}
	
	
	public int getColumn() {
		return column;
	}
	
	
	public void setColumn(int column) {
		if (column <= 0)
			throw new IllegalArgumentException("The column must be positive");
		this.column = column;
	}
			
	
	public int getRow() {
		return row;
	}
	
	
	public void setRow(int row) {
		if (row <= 0)
			throw new IllegalArgumentException("The row must be positive");
		this.row = row;
	}
	
	
	public String getContent() {
		return content;
	}
	
	
	public void setContent(String content) {
		if (content == null || content.isEmpty())
			throw new IllegalArgumentException("The content is null or empty");
		this.content = content;
	}
	
}
